

<script>
    $(function () {
        //跟进时间使用日期插件
        $("input[name=traceTime]").datepicker({
            language: "zh-CN", //语言
            autoclose: true, //选择日期后自动关闭
            clearBtn: true, //加入清楚按钮
            todayHighlight: true //高亮当天日期
        });

        // 跟进按钮
        $('.btn-trace').click(function () {
            // 清空模态框
            $("#traceForm input").val('');
            $("#traceForm textarea").val('');
            //回显数据
            var json = $(this).data('json');
            $("#traceForm input[name='customer.name']").val(json.name)
            $("#traceForm input[name='customer.id']").val(json.id);
            // 点击时弹出模态框
            $('#traceModal').modal('show');
        });
        $('.trace-submit').click(function () {
            //点击保存按钮
            //ajaxSubmit方法可以把表单转为异步的表单，马上提交
            $('#traceForm').ajaxSubmit(handlerMessage);
        })
    })
</script>

<div class="modal fade" id="traceModal" tabindex="-1" role="dialog" aria-labelledby="traceModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">跟进</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/customerTraceHistory/saveOrUpdate.do" method="post" id="traceForm">
                    <#-- 跟进客户的id隐藏提交 -->
                    <input type="hidden" name="customer.id"/>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">客户姓名：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" readonly name="customer.name"/>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">跟进时间：</label>
                        <div class="col-lg-6 ">
                            <input type="text" class="form-control"  name="traceTime"  placeholder="请输入跟进时间">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 control-label">交流方式：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="traceType.id">
                                <#list ccts! as c>
                                    <option value="${(c.id)!}">${(c.title)!}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">跟进结果：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="traceResult">
                                <option value="3">优</option>
                                <option value="2">中</option>
                                <option value="1">差</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="col-lg-4 control-label">跟进记录：</label>
                        <div class="col-lg-6">
                            <textarea type="text" class="form-control" name="traceDetails"
                                      placeholder="请输入跟进记录" name="remark"></textarea>
                        </div>
                    </div>
                </form>
                <div class="modal-footer">
                    <button type="button" class="btn trace-submit">保存</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
</div>


